package com.fzf.org.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;

import java.util.concurrent.Executors;


@Configuration
public class SchedulingConfig implements SchedulingConfigurer {

    private static final int SCHEDULING_MAX_THREAD = 5;

    @Override
    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
        taskRegistrar.setScheduler(Executors.newScheduledThreadPool(SCHEDULING_MAX_THREAD));
    }

}
